﻿using System;
using System.Web;
using System.Collections.Generic;


/// <summary>
/// 关键词管理
/// </summary>
public static class HotWordMan
{
    //增加搜索次数
    public static void AddKeyword(String keyword)
    {
        HotWord newHotWord = new HotWord(
            keyword,
            1,
            DateTime.Now.ToString());

        DAMS.DataAccess.Insert(newHotWord);

    }
    
    public static String[] getHotWord()
    {
        DateTime startTime = DateTime.Now.AddDays(-7); //一个星期内的
        Int32 topCount = 10; 
        List<HotWord> wordList = DAMS.DataAccess.GetHotWords(startTime, topCount);

        int count = wordList.Count; 
        String[] word = new String[count];
        int i = 0;
        foreach( HotWord t in wordList )
        {
            word[i] = t.Keyword; 
            ++i ;
        }
 
        return word ;
   
    }

    public static void DeleteHotWord(String keyword)
    {
        DAMS.DataAccess.DeleteHotWord(keyword);
    }

}
